<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored ="false"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%
	String path = request.getContextPath();
%>
<div class="inner-dialog-content" style="padding-bottom: 16px;">
	<script type="text/javascript">
		var path = "<%=path%>";
	</script>
	<script type="text/javascript" src="<%=path%>/javascript/core/jquery-1.6.1.min.js"></script>
	<script type="text/javascript" src="<%=path%>/javascript/system/util.js"></script>
	<script type="text/javascript" src="<%=path%>/javascript/system/oacore.js"></script>
	<script type="text/javascript">
		$(function () {
				function getLowLevelRecord(target) {
					var $target = $(target);
					var level = parseInt(levelExp.exec($target.attr("class"))[0].split("-")[1]);
					var lowLevels = [];
					$target.nextAll("div.level-" + (level + 1)).each(function () {
							var $this = $(this);
							if($this.prevAll("div.level-" + level + ":first").get(0) == target)
								lowLevels.push(this);
						});
					return lowLevels;
				};
	
				function closeAllChildren(lowLevels) {
					for(var i = 0;i<lowLevels.size(); ++i)
					{
						var lowLevelMore = $(getLowLevelRecord(lowLevels.get(i)));
						closeAllChildren(lowLevelMore);
						lowLevelMore.hide().children("span.low-level-view-switch").removeClass("opened");
					}
					lowLevels.hide().children("span.low-level-view-switch").removeClass("opened").removeData("opened");
				};
				
				var levelExp = /\blevel-[\d]+\b/;
				$("div.op-record span.or-content").each(function () {
						var $this = $(this);
						var viewSwitch = $("<span class='low-level-view-switch'></span>");
						if($(getLowLevelRecord($this.parents("div.op-record:first").get(0))).size() > 0)
							$this.after(viewSwitch);
					});
				$("span.low-level-view-switch").click(function () {
						var host = this;
						var $this = $(host);
						var parent = $this.parents("div.op-record:first").get(0);
						var lowLevels = $(getLowLevelRecord(parent));
						if($this.data("opened"))
						{
							closeAllChildren(lowLevels);
							$this.removeClass("opened");
						}
						else
						{
							$(this).addClass("opened");
							lowLevels.show();
						}
						$this.data("opened", $this.data("opened") ? false : true);
					});
			});
	</script>
	<div class="op-records">
		<s:iterator value="historyList" status="i">
			<s:if test="level > 1">
				<div class="level-${level } op-record" style="display: none;">
			</s:if>
			<s:else>
				<div class="level-${level } op-record">
			</s:else>
				<s:iterator begin="2" end="level">
					<span class="space-block"></span>
				</s:iterator>
					<span class="or-content">
						<s:if test='detailURL != null && !jobType.contains("退回")'>
							<a href="javascript: oacore.Util.openUrl('${detailURL}?jobId=${jobId}&jobType=${jobType}&jobState=${jobState}');">
						    	<s:property value="actualEndTime"/>&nbsp;<s:property value="operatorName"/>&nbsp;<s:property value="content"/>
						    </a>
						</s:if>
						<s:else>
						     <s:property value="actualEndTime"/>&nbsp;<s:property value="operatorName"/>&nbsp;<s:property value="content"/>
						</s:else>
					</span>
			</div>
		</s:iterator>
		<s:if test="missionEnded == true">
			<div class="level-1 op-record">
				任务结束
			</div>
		</s:if>
</div>